package org.hardcode.rpc.protocol.header;

import org.hardcode.rpc.common.id.IdFactory;
import org.hardcode.rpc.constants.RpcConstants;
import org.hardcode.rpc.protocol.enumeration.RpcType;

/**
 * 工厂类
 */
public class RpcHeaderFactory {

    public  static RpcHeader   getRequestHeader(String  serializationType){
        RpcHeader header = new RpcHeader();
        long  requestId = IdFactory.getId();
        header.setMagic(RpcConstants.MAGIC);
        header.setRequestId(requestId);
        header.setMsgType((byte)RpcType.REQUEST.getType());
        header.setStatus((byte)0x1);
        header.setSerializationType(serializationType);
        return header;

    }
}
